package vip.liux.front.adapter.amqp;

import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import static vip.liux.front.infrastructure.constants.MqExchangeConst.MESSAGE_ASYNC_NOTIFY;

@Component
public class RabbitMqListener {

    private final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(this.getClass());

    @RabbitListener(bindings = @QueueBinding(
            key = MESSAGE_ASYNC_NOTIFY,
            value = @Queue(value = MESSAGE_ASYNC_NOTIFY, durable = "true"),
            exchange = @Exchange(value = "${spring.rabbitmq.template.exchange}")
    ))
    public void cachePutHandler(String message) {
        logger.info("收到异步消息通知:{}", message);
    }
}
